#include <stdio.h>
void bubble_sort(int array[], int length)
{
    int i, j, temp;
    for (i = 0; i < length - 1; i++)
    {
        /* code */
        for (j = 0; j < length - i - 1; j++)
        {
            if (array[j] > array[j + 1])
            {
                temp = array[j];
                array[j] = array[j + 1];
                array[j + 1] = temp;
            }
        }
    }
}

int main()
{
    printf("Hello, world!\n");

    int aray[] = {10, 3, 6, 2, 7, 8, 9, 1, 4, 5};
    int length = sizeof(aray) / sizeof(int);
    printf("排序前的数组：");
    for (int i = 0; i < length; i++)
    {
        printf("%d", aray[i]);
    }

    bubble_sort(aray, length);

    printf("排序后的数组：");
    for (int i = 0; i < length; i++)
    {
        printf("%d", aray[i]);
    }
    return 0;
}
